package com.foreknow.demo8;

public class TestMethod {
    public void m1(int a){
        System.out.println(a);
    }

    public int m2(){
        return 12;
    }

    //
    public void m3(String email){
        System.out.println(email);
    }

    public String m4(){
        return "张三";
    }

    public void m5(int[] a){
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
    }

    public int[] m6(int[] a){
        return a;
    }

    public void m7(Student student){
        System.out.println(student.getName()+"---"+student.getAge());
    }

    public Student m8(Student s){
        return s;
    }

    public boolean m9(A a,String username,String password){
        boolean isRigth = a.login(username,password);
        return isRigth;
    }

    public int m10(X x,Student s){
        return x.add(s);
    }

    public X m11(X a){//a = XImpl()
        return a;
    }

    public Student[] m12(Student[] stu){
        return stu;
    }


    public static void main(String[] args) {
        TestMethod method = new TestMethod();
        method.m1(12);

        int num = method.m2();
        System.out.println(num);

        method.m3("tom@163.com");

        String name = method.m4();
        System.out.println(name);

        int[] array = {1,2,3,4,5};
        method.m5(array);

       int[] result = method.m6(array);
       for (int i = 0;i<result.length;i++)
           System.out.println(result[i]);

       Student s = new Student();
       s.setId("1001");
       s.setName("tom");
       s.setAge(30);
       method.m7(s);

       Student stu = method.m8(s);
       method.m7(stu);

       B b = new B();
       boolean isRight = method.m9(b,"tom","123456");
       if (isRight){
           System.out.println("success......");
       }else {
           System.out.println("error......");
       }

       X x=new XImpl();
       int i = method.m10(x,s);
       if (i==1){
           System.out.println("添加成功");
       }else
           System.out.println("添加失败");

       X xx = method.m11(x);
       int j=xx.add(new Student());
        System.out.println(j);

        Student s1 = new Student();
        s1.setId("1001  ");
        s1.setName("tom  ");
        s1.setAge(30);
        Student s2 = new Student();
        s2.setId("1002  ");
        s2.setName("tom  ");
        s2.setAge(31);
        Student[] students = new Student[2];
        students[0] = s1;
        students[1] = s2;
        Student[] ss= method.m12(students);
        for (int k = 0;k<ss.length;k++)
            System.out.println(ss[k].getId()+ss[k].getName()+ss[k].getAge());
    }
}
